"""
Author: luthor luthor-li@qq.com
Date: 2024-05-02 23:52:50
LastEditors: luthor luthor-li@qq.com
LastEditTime: 2024-05-02 23:53:00
FilePath: \connecteverything\common\shocksensor.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
"""

from machine import Pin
import time


# 引脚配置
p23 = Pin(23, Pin.IN)
p2 = Pin(2, Pin.OUT)

while True:
    ret = p23.value()  # 读取传感器数据
    print(ret)

    if ret:
        for i in range(3):  # 通过led闪烁的方式报警
            p2.value(1)
            time.sleep(0.5)
            p2.value(0)
            time.sleep(0.5)

    time.sleep(0.1)
